const express = require('express')
const app = express()
const bodyParser = require('body-parser')

// 将参数转换成对象
app.use(bodyParser.urlencoded({extended: true}))

app.get('/api/jsonp', function(req, res) {
  let {callback} = req.query
  res.header('Content-Type', 'text/javascript')
  res.send(`${callback}('4000端口发来贺电')`)
})

app.listen(4000, function(req, res) {
  console.log("4000端口服务器也打开，可以访问接口")
})